package com.chb.docter.controller.apis;

import com.chb.docter.dto.CommentDto;
import com.chb.docter.params.CommentParam;
import com.chb.docter.service.CommentService;
import com.hos.entity.sys.Comment;
import com.hos.entity.sys.User;
import com.hos.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: 陈海彬
 * @date: Created in 2023/12/25 9:12
 * @description: 医生评价控制层
 * @modified By:
 * @version: 1.0
 */
@RestController
@RequestMapping("docter/api/comment")
@Api(tags = "对医生评价的相关功能")
public class ApiCommentController {

    @Resource
    private CommentService commentService;

    @GetMapping("getUserByChId/{chId}")
    @ApiOperation("通过病例id找到对应的医生信息")
    public Result<User> getUserByChId(@PathVariable String chId) {
        return new Result<>(200, "查询成功", commentService.getUserByChId(chId));
    }

    @PostMapping("insertComment")
    @ApiOperation("对医生进行添加评论")
    public Result<Comment> insertComment(@RequestBody CommentParam commentParam) {
        return new Result<>(200, "评价成功", commentService.addCommentByChId(commentParam));
    }

    @GetMapping("getAllByUserId/{id}")
    @ApiOperation("通过医生id找到对应的医生信息")
    public Result<Comment> getAllByUserId(@PathVariable String id) {
        return new Result<>(200, "查询成功", commentService.getAllByUserId(id));
    }

    @GetMapping("getUserCommentById/{id}")
    @ApiOperation("根据医生Id查询评论数")
    public Result<List<CommentDto>> getUserCommentById(@PathVariable String id) {
        return new Result<>(200, "查询成功", commentService.getUserCommentById(id));
    }

}